/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package syferserver;

import java.util.Vector;

/**
 *
 * @author Stein
 */
public class Container {
    private static Vector ports = new Vector();

    /**
     * Creates a new channel on a random port between 40 000 and 65 000
     * The port gets added to a list
     * @return port number
     */
    public static String addChannel(){
        int poort = (int)(Math.floor(Math.random()*25000+40000));
        if(ports.contains(poort))
            return Container.addChannel();
        else{
            ports.add(poort);
            new Channel(poort).start();
            return poort+"";
        }
    }
}
